package environnement;

import java.util.ArrayList;
import java.util.HashMap;

import environnement.interfaces.IEnv;

public class Env implements IEnv{
	private HashMap<String, Integer> R;
	private HashMap<String, ArrayList<Object>> P;
	private HashMap<String, ArrayList<Object>> F;

	public Env(HashMap<String, Integer> R,HashMap<String, ArrayList<Object>> P,HashMap<String, ArrayList<Object>> F){
		this.R = R;
		this.P = P;
		this.F = F;
	}
	
	public Env(){
		R = new HashMap<String, Integer>();
		P = new HashMap<String, ArrayList<Object>>();
		F = new HashMap<String, ArrayList<Object>>();	
	}
	
	@Override
	public HashMap<String, Integer> getR() {
		return R;
	}

	@Override
	public HashMap<String, ArrayList<Object>> getP() {
		return P;
	}

	@Override
	public HashMap<String, ArrayList<Object>> getF() {
		return F;
	}
	
	public String toString(){
		String ret="";
		ret+="R:=" + R.toString()+"\n";
		ret+="P:=" + P.toString()+"\n";
		ret+="F:=" + F.toString()+"\n";
		return ret;
	}

	@SuppressWarnings("unchecked")
	public IEnv clone(){
		IEnv env_new = new Env((HashMap<String, Integer>) getR().clone(), (HashMap<String, ArrayList<Object>>) getP().clone(), (HashMap<String, ArrayList<Object>>) getF().clone());
		return env_new;
	}
	
}
